#include "Virus.h"
Virus::Virus()
{
	cout<<"Constructor Virus class"<<endl;
	//this->DoBorn();
	//this->InitResistance();
	
}
Virus::Virus(const Virus& virus)
{
	this->m_dna = new char[SIZE_NAME_ADN];
	this->m_dna = virus.m_dna;
	this->m_resistance = virus.m_resistance;
}
Virus::~Virus()
{
	cout<<"Destructor Virus!!!"<<endl;
	//delete m_dna;
	
}

void Virus::SetDNA(char* m_dna)
{
	bool isCheck = true;
	for(int i = 0; i < sizeof(m_dna); i ++)
	{
		if(m_dna[i] != 'A' || m_dna[i] != 'T' || m_dna[i] != 'G' || m_dna[i] != 'X' )
		{
			isCheck = false;

		}
	}
	if(isCheck)
	this->m_dna = m_dna;
	else 
		cout<<"The ADN of virus invail!!"<<endl;
	

}
void Virus::InitResistance()
{
	
	this->m_resistance = rand()%30 + 10;
	
}
char* Virus::GetName()
{
	return this->m_dna;
}
void Virus::ReduceResistance(int medicineResistance)
{
	this->m_resistance = this->m_resistance - medicineResistance ;
	/*if(this->m_resistance <= 0)
	{
		this->DoDie();
	}*/

}
void Virus::LoadDNAInformation()
{

	this->m_dna = new char[SIZE_NAME_ADN];
	FILE *file;
   file = fopen("ATGX.bin", "r");
   this->m_dna[SIZE_NAME_ADN - 1] = '\0';
   fread(this->m_dna, 1, SIZE_NAME_ADN, file);
   fclose(file);
}
